/*
 * 创建人： Created by  on 2020/12/3.
 * 创建时间：Created by  on 2020/12/3.
 * 页面说明：
 * 可关注公众号：我的大前端生涯   获取最新技术分享
 * 可关注网易云课堂：https://study.163.com/instructor/1021406098.htm
 * 可关注博客：https://blog.csdn.net/zl18603543572
 */

import 'bean_category.dart';
import 'bean_integral.dart';

class UserAccountBean {
  num totalAmount;
  int orderCnt;
  num remainAmount;
  num orderSettleAmt;

  ///常用用于解析JSON数据
  UserAccountBean.fromMap(Map<String, dynamic> map) {
    if (map != null) {
      this.remainAmount = map["remainAmount"] ?? 0.0;
      this.totalAmount = map["totalAmount"] ?? 0.0;
      this.orderSettleAmt = map["orderSettleAmt"] ?? 0.0;
      this.orderCnt = map["orderCnt"] ?? 0;
    }
  }
}

class UserSpecialAccountBean {
  num sanweiAmount;
  num noWorkAmount;
  num qianliAmount;

  ///常用用于解析JSON数据
  UserSpecialAccountBean.fromMap(Map<String, dynamic> map) {
    if (map != null) {
      this.sanweiAmount = map["sanweiAmount"] ?? 0.0;
      this.noWorkAmount = map["noWorkAmount"] ?? 0.0;
      this.qianliAmount = map["qianliAmount"] ?? 0.0;
    }
  }
}

class UserAccountStateBean {
  num totalCount;

  num currMonthSettleMoney;

  UserAccountBean accountBean;

  UserAccountBean yestodayData;
  UserAccountBean weekData;
  UserAccountBean monthData;

  ///常用用于解析JSON数据
  UserAccountStateBean.fromMap(Map<String, dynamic> map) {
    totalCount = map['totalCount'] ?? 0;
    if (map != null) {
      dynamic account = map["userAccount"];
      if (account != null) {
        this.accountBean = UserAccountBean.fromMap(account);
      }
      dynamic yestodayData = map["yestodayData"];
      if (yestodayData != null) {
        this.yestodayData = UserAccountBean.fromMap(yestodayData);
      }

      this.currMonthSettleMoney = map["currMonthSettleMoney"] ?? 0;

      dynamic weekData = map["weekData"];
      if (weekData != null) {
        this.weekData = UserAccountBean.fromMap(weekData);
      }

      dynamic monthData = map["monthData"];
      if (monthData != null) {
        this.monthData = UserAccountBean.fromMap(monthData);
      }
    }
  }
}

class UserAccountWaterBean {
  String remark;
  String createTimeStr;
  String createTime;
  num remainAmount;
  int type;

  ///常用用于解析JSON数据
  UserAccountWaterBean.fromMap(Map<String, dynamic> map) {
    if (map != null) {
      this.type = map["type"] ?? 1;
      this.remark = map["remark"] ?? "";
      this.createTimeStr = map["createTimeStr"] ?? "";
      this.createTime = map["createTime"] ?? "--";
      this.remainAmount = map["remainAmount"] ?? 0.0;
    }
  }
}

class TaskBean {
  int id = 0;
  String taskName = "";
  String showTaskInfo = "";
  String showFinishInfo = "";
  String taskInfo = "";

//目标数量
  int taskNumber = 1;

  //已完成的数量;
  int taskCount = 0;

  //任务状态 0 正常 ； 1 禁用
  int taskStatus = 0;

  //任务周期 0 每日 ； 1 每周 ；2 每月
  int taskDate = 0;

  // 任务类型 0 阅读 ； 1 学习；2 看视频
  int taskFlag = 0;

  //  0 未开始  1 进行中  2 已结束
  int taskStart = 0;

  //  0 显示 1 不显示
  int taskShow = 0;

  // 参与部门 0 全部 ； 1 指定
  int taskDepartment = 0;

  // false 不允许再次参与任务
  bool goDoing = true;

  //任务详情页面显示的说明
  String taskDetailsRemark = "";

  List<CategoryBean> appStudyCategoryList;

  IntegralStatBean examinConfig;

  //任务时间 秒
  int readTimes = 0;

  ///常用用于解析JSON数据
  TaskBean.fromMap(Map<String, dynamic> map) {
    if (map != null) {
      this.id = map["id"] ?? 0;
      this.taskNumber = map["taskNumber"] ?? 1;
      this.taskCount = map["taskCount"] ?? 0;
      this.readTimes = map["readTimes"] ?? 0;

      this.taskDetailsRemark = map["taskDetailsRemark"] ?? "";
      this.goDoing = map["goDoing"] ?? false;

      this.taskName = map["taskName"] ?? "";
      this.showTaskInfo = map["showTaskInfo"] ?? "";
      this.showFinishInfo = map["showFinishInfo"] ?? "";
      this.taskInfo = map["taskInfo"] ?? "";

      this.taskStatus = map["taskStatus"] ?? 0;
      this.taskDate = map["taskDate"] ?? 0;
      this.taskFlag = map["taskFlag"] ?? 0;

      this.taskStart = map["taskStart"] ?? 0;
      this.taskShow = map["taskShow"] ?? 0;
      this.taskDepartment = map["taskDepartment"] ?? 0;

      ///任务中的答题分类
      ///任务中的学习分类
      if (map["appStudyCategoryList"] != null) {
        List studyList = map["appStudyCategoryList"];
        List<CategoryBean> themList = [];
        for (int i = 0; i < studyList.length; i++) {
          CategoryBean categoryBean = CategoryBean.fromJson(studyList[i]);
          themList.add(categoryBean);
        }
        this.appStudyCategoryList = themList;
      }

      ///任务中关联的积分配置
      if (map["examinConfig"] != null) {
        examinConfig = IntegralStatBean.fromJson(map["examinConfig"]);
      }
    }
  }
}

class TaskBeanDetails {
  String remark;
  String createTimeStr;
  String createTime;
  String itemName;
  num remainAmount;
  String itemId = "";
  int type;

  ///常用用于解析JSON数据
  TaskBeanDetails.fromMap(Map<String, dynamic> map) {
    if (map != null) {
      this.type = map["itemType"] ?? 1;
      this.itemId = map["itemId"] ?? "0";
      this.itemName = map["itemName"] ?? "";
      this.remark = map["itemName"] ?? "";
      this.createTimeStr = map["createTimeStr"] ?? "";
      this.createTime = map["createTime"] ?? "--";
      this.remainAmount = map["remainAmount"] ?? 0.0;
    }
  }
}
